package com.chenjt.netty.eight_nio.bufferAttribute;

import java.nio.ByteBuffer;

/**
 * 注释：ByteBuffer类型化的put与get方法
 *
 * @author chenjt
 * @date 2024/8/21 11:39
 */
public class BufferPutAndGet {


    public static void main(String[] args) {
        ByteBuffer buffer = ByteBuffer.allocate(64);

        buffer.putInt(15);
        buffer.putLong(50000000L);
        buffer.putDouble(3.1415926);
        buffer.putChar('你');
        buffer.putShort((short)2);
        buffer.putChar('我');

        buffer.flip();

        System.out.println(buffer.getInt());
        System.out.println(buffer.getLong());
        System.out.println(buffer.getDouble());
        System.out.println(buffer.getChar());
        System.out.println(buffer.getShort());
        System.out.println(buffer.getChar());


    }

}
